package mysqloperate;

import people.Student;

import java.sql.Connection;
import java.sql.Statement;

public class changestumysql {
    Student student;
    public changestumysql(){

    }
    public changestumysql(Student student){

        this.student=student;
    }

    public void change()throws Exception{
        String sql="update student set name="+student.getName()+",sex="+student.getSEX()+",shengri="+student.getBirth()+",math='"+student.getMath()+"',java='"+student.getMath()+"',PE='"+student.getPe()+"' where studyid="+student.getStudentid();
        connection con=new connection();
        Connection connection=con.getconnection();
        Statement statement=connection.createStatement();
        int num=statement.executeUpdate(sql);
        statement.close();
        connection.close();
    }

}

